import req from '@/http/http'
import {getServer} from '@/http/AppApi'

let ZHPQ_SERVER = getServer()

// 实有人口
// 获取 查询 分页
export const getPopulation = identityNumber => {
  let path = ZHPQ_SERVER + '/population/' + identityNumber
  return req.get(path)
}

// 流动人口
// 修改
export const updateMobilePopulation = data => {
  let path = ZHPQ_SERVER + '/mobilePopulation/' + data.id
  return req.put(path, data)
}
// 删除
export const delMobilePopulation = data => {
  let path = ZHPQ_SERVER + '/mobilePopulation/' + data.id
  return req.delete(path)
}
// 获取 查询 分页
export const getMobilePopulation = param => {
  let path = ZHPQ_SERVER + '/mobilePopulation'
  return req.get(path, param)
}
// 新增
export const createMobilePopulation = data => {
  let path = ZHPQ_SERVER + '/mobilePopulation/'
  return req.post(path, data)
}
// 查看
export const getDetailMobilePopulation = id => {
  let path = ZHPQ_SERVER + '/mobilePopulation/' + id
  return req.get(path)
}

// 户籍人口
// 修改
export const updateHouseholdPopulation = data => {
  let path = ZHPQ_SERVER + '/householdPopulation/' + data.id
  return req.put(path, data)
}
// 删除
export const delHouseholdPopulation = data => {
  let path = ZHPQ_SERVER + '/householdPopulation/' + data.id
  return req.delete(path)
}
// 获取 查询 分页
export const findHouseholdPopulation = param => {
  let path = ZHPQ_SERVER + '/householdPopulation'
  return req.get(path, param)
}
// 新增
export const createHouseholdPopulation = data => {
  let path = ZHPQ_SERVER + '/householdPopulation/'
  return req.post(path, data)
}
// 查看
export const getDetailHouseholdPopulation = id => {
  let path = ZHPQ_SERVER + '/householdPopulation/' + id
  return req.get(path)
}
// 留守人口
// 修改
export const updateLeftBehindPopulation = data => {
  let path = ZHPQ_SERVER + '/leftBehindPopulation/' + data.id
  return req.put(path, data)
}
// 删除
export const delLeftBehindPopulation = data => {
  let path = ZHPQ_SERVER + '/leftBehindPopulation/' + data.id
  return req.delete(path)
}
// 获取 查询 分页
export const findLeftBehindPopulation = param => {
  let path = ZHPQ_SERVER + '/leftBehindPopulation'
  return req.get(path, param)
}
// 新增
export const createLeftBehindPopulation = data => {
  let path = ZHPQ_SERVER + '/leftBehindPopulation/'
  return req.post(path, data)
}
// 查看
export const getDetailLeftBehindPopulation = id => {
  let path = ZHPQ_SERVER + '/leftBehindPopulation/' + id
  return req.get(path)
}

// 境外人员
export const findOverseasPerson = param => {
  let path = '/overseasPerson'
  return req.get(path, param)
}

export const updateOverseasPerson = data => {
  let path = '/overseasPerson/' + data.id
  return req.put(path, data)
}

export const delOverseasPerson = data => {
  let path = '/overseasPerson/' + data.id
  return req.delete(path)
}

export const getOverseasPerson = id => {
  let path = '/overseasPerson/' + id
  return req.get(path)
}

export const createOverseasPerson = data => {
  let path = '/overseasPerson/'
  return req.post(path, data)
}

// 出租房人口关联
// 根据证件号码获取人口信息
export const getPopDetail = data => {
  let path = ZHPQ_SERVER + '/population/relateHouse/' + data.type + '/' + data.num
  return req.get(path)
}
// 添加人口关联
export const addPopDetail = data => {
  let path = ZHPQ_SERVER + '/population/createRelateHouse/' + data.id + '/' + data.gridId
  return req.put(path, data.item)
}
// 取消人口关联
export const deletePopDetail = data => {
  let path = ZHPQ_SERVER + '/population/deleteRelateHouse/' + data.id
  return req.put(path, data.item)
}
// 获取人口关联
export const findPopDetail = data => {
  let path = ZHPQ_SERVER + '/population/getPopByHouse/' + data
  return req.get(path)
}

// 院落人口关联
// 根据证件号码获取人口信息
export const getPopCDetail = data => {
  let path = ZHPQ_SERVER + '/population/relateCourtyard/' + data.type + '/' + data.num
  return req.get(path)
}
// 添加人口关联
export const addPopCDetail = data => {
  let path = ZHPQ_SERVER + '/population/createRelateCourtyard/' + data.id + '/' + data.gridId
  return req.put(path, data.item)
}
// 取消人口关联
export const deletePopCDetail = data => {
  let path = ZHPQ_SERVER + '/population/deleteRelateCourtyard/' + data.id
  return req.put(path, data.item)
}
// 获取人口关联
export const findPopCDetail = data => {
  let path = ZHPQ_SERVER + '/population/getPopByCourtyard/' + data
  return req.get(path)
}

export const findPopDetailList = data => {
  let path = ZHPQ_SERVER + '/population/getPopByHouseId'
  return req.get(path, data)
}

export const findPopCDetailList = data => {
  let path = ZHPQ_SERVER + '/population/getPopByCourtyardId'
  return req.get(path, data)
}
